package com.teaphy.coroutinecrawler.flow.operators.transform

import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*

fun main() = runBlocking {
    flow {
        emit("a")
        delay(100)
        emit("b")
    }.mapLatest { value ->
        println("Started computing $value")
        delay(200)
        "Computed $value"
    }
        .collect {
            println("result: $it")
        }

    println("Done")
}
